package org.example.dao;

import org.example.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class StuDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public List<Student> getAll() {
        String sql = "select * from student";
        List<Student> StuList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<Student>(Student.class));
        return StuList;
    }
}
